import Vue from 'vue'
import {fetch, put, post, del} from "./baseApi";

Vue.prototype.$fetch = fetch
Vue.prototype.$put = put
Vue.prototype.$post = post
Vue.prototype.$delete = del
export const getCateList = (payload) => {
  return Vue.prototype.$fetch("categories", payload)
}
export const getParentCateList = (payload) => {
  return Vue.prototype.$fetch("categories", payload)
}
export const addCate = (payload) => {
  return Vue.prototype.$post('categories', payload)
}
export const getCateById = (id) => {
  return Vue.prototype.$fetch("categories/" + id)
}
export const updateCateInfo = (payload) => {
  return Vue.prototype.$put("categories/" + payload.id, payload.cat_name)
}
export const removeCateById = (id) => {
  return Vue.prototype.$delete("categories/" + id)
}
